package com.lzh.persevere.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lzh.persevere.mapper.SystemInfoMapper;
import com.lzh.persevere.model.entity.SystemInfo;
import com.lzh.persevere.model.qo.system.SystemInfoQO;
import com.lzh.persevere.service.SystemInfoService;
import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.stream.Collectors;

/**
 * 系统信息表服务实现类
 *
 * @author luzhiheng
 * @since 2025-07-22
 */
@Service
public class SystemInfoServiceImpl extends ServiceImpl<SystemInfoMapper, SystemInfo> implements SystemInfoService {

    @Override
    public Map<String, String> findSystemValueByTypes(SystemInfoQO qo) {
        return baseMapper.selectList(Wrappers.<SystemInfo>lambdaQuery().in(SystemInfo::getType, qo.getTypeList()))
                .stream()
                .collect(Collectors.toMap(e -> String.valueOf(e.getType()), SystemInfo::getSystemValue));
    }
}
